import request from '@/core/net/request'
import { queryParams } from '@/core/utils/tools'
export function login(username, password) {
  return request.post('/admin/login', {
    username,
    password,
  })
}

export function getinfo() {
  return request.post('/api/admin/getinfo')
}

export function logout() {
  return request.post('/api/admin/logout')
}

export function updatepassword(data) {
  return request.post('/api/admin/updatepassword', data)
}

export function getManagerList(page, query = {}) {
  const r = queryParams(query)
  return request.get(`/api/admin/manager/${page}${r}`)
}

export function updateManagerStatus(id, status) {
  return request.post(`/api/admin/manager/${id}/update_status`, {
    status,
  })
}

export function createManager(data) {
  return request.post(`/api/admin/manager`, data)
}

export function updateManager(id, data) {
  return request.post(`/api/admin/manager/${id}`, data)
}

export function deleteManager(id) {
  return request.post(`/api/admin/manager/${id}/delete`)
}
